package main

import (
	"runtime"
	"fmt"
)

// ldflags
var (
	Version   = "(Unknown Version)"
	Builddate = "No Build Date Provided."
	Buildhash = "No Git-hash Provided."
)

var logger *Logger = NewLogger(LogLevelInfo, nil)
var config *Config = NewConfig()

func main() {
	const title = `Jetbrains License Server %s
Date: %s
Build: %s
Git Hash: %s

`
	GoVersion := fmt.Sprintf("%s %s/%s", runtime.Version(), runtime.GOOS, runtime.GOARCH)
	fmt.Printf(title, Version, Builddate, GoVersion, Buildhash)

	if config.PrintVersionAndExit {
		return
	}

	if config.Debug {
		logger.SetLevel(LogLevelDebug)
	}

	// init key
	InitRSAKey()
	// run HTTP server
	RunHTTPServer()
}
